Closed
Bug 1342657
Opened 8 years ago
Closed 8 years ago
clang-format incorrectly format layout/style/nsCSSPropAliasList.h
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Developer Infrastructure
Source Code Analysis
Tracking
(firefox54 affected, firefox57 fixed)
RESOLVED
FIXED
mozilla57
People
(Reporter: Sylvestre, Assigned: andi)
References
Details
Attachments
(1 file)
-CSS_PROP_ALIAS(-moz-perspective-origin,
+CSS_PROP_ALIAS(-moz - perspective - origin,
Which is obviously breaking the build.
Reporter | ||
Comment 1•8 years ago
|
||
the build fails with:
File "/home/sylvestre/dev/mozilla/mozilla-central.else.change/other-licenses/ply/ply/yacc.py", line 263, in parse
return self.parseopt(input,lexer,debug,tracking,tokenfunc)
File "/home/sylvestre/dev/mozilla/mozilla-central.else.change/other-licenses/ply/ply/yacc.py", line 792, in parseopt
tok = self.errorfunc(errtoken)
File "/home/sylvestre/dev/mozilla/mozilla-central.else.change/dom/bindings/parser/WebIDL.py", line 6770, in p_error
raise WebIDLError("invalid syntax", [Location(self.lexer, p.lineno, p.lexpos, self._filename)])
WebIDL.WebIDLError: error: invalid syntax, /home/sylvestre/dev/mozilla/mozilla-central.else.change/obj-x86_64-pc-linux-gnu/dom/bindings/CSS2Properties.webidl line 5:90
[Throws, TreatNullAs=EmptyString, BinaryName="alignContent"] attribute DOMString _align - content;
^
Makefile:55 : la recette pour la cible « codegen.pp » a échouée
Reporter | ||
Comment 2•8 years ago
|
||
Reverting the indentation of layout/style/nsCSSPropAliasList.h & layout/style/nsCSSPropList.h
fixes the issue
Reporter | ||
Comment 3•8 years ago
|
||
Test case
void foo() {
---
CSS_PROP_ALIAS(-moz-perspective-origin,
"bar");
}
---
clang-format-5.0 foo.cpp
void foo() { CSS_PROP_ALIAS(-moz - perspective - origin, "bar"); }
Reporter | ||
Comment 4•8 years ago
|
||
#define DO_PROP(name, method, id, flags, pref, proptype) \
[ #name, #method, #id, PROP_STRINGIFY(flags), pref, proptype ]
#define CSS_PROP_ALIAS(name, id, method, pref) \
DO_PROP(name, method, id, 0, pref, "alias")
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → bpostelnicu
Assignee | ||
Comment 5•8 years ago
|
||
The problem here is that clang-format is built on a token stream based processing so it cannot distinguish a function call from a macro call, thus in this case it believes that:
>>CSS_PROP_ALIAS(-moz-perspective-origin,
>> "bar");
It's a function call, and the first parameters is analysed as an expression that leads to the literal to be indented.
Taking all of this into account I think the best approach would be to change the names of the variables/ literals involved.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 7•8 years ago
|
||
mozreview-review |
Comment on attachment 8898257 [details]
Bug 1342657 - clang-format: Ignore two files which are using some #define trick
https://reviewboard.mozilla.org/r/169628/#review175630
Thank you and sorry for the delay!
Attachment #8898257 -
Flags: review?(bpostelnicu) → review+
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2c00fbd09ddc
clang-format: Ignore two files which are using some #define trick r=andi
![]() |
||
Comment 9•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Updated•7 years ago
|
Product: Core → Firefox Build System
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•